package com.example.androidtest;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

public class ThirdActivity extends AppCompatActivity {

    private ImageView imageView = null;
    private  Button button_third_2 = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        EditText mUserName, mPwd;
        mUserName = this.findViewById(R.id.ed_User);
        mPwd = this.findViewById(R.id.ed_Pwd);

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_third);



        imageView=(ImageView)findViewById(R.id.imageView);
        button_third_2 = (Button) findViewById(R.id.button_third_2) ;
        button_third_2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(v == button_third_2){
                    imageView.setImageResource(R.drawable.er);
                }
            }
        });








        EditText ed_user =  (EditText) findViewById(R.id.ed_User);
        EditText ed_pwd =(EditText)findViewById(R.id.ed_Pwd);
        Button button_third_1 = (Button)findViewById(R.id.button_third_1);
        button_third_1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()){
                    case R.id.button_third_1:
                        if ("333".equals(mUserName.getText().toString()) && "333".equals(mPwd.getText().toString())) {


                            startActivity(new Intent(ThirdActivity.this,SecondMainActivity.class));

                    }
                        else if (mUserName.getText().toString().isEmpty() || mPwd.getText().toString().isEmpty())
                        {


                           return;
                        }

                        else
                        {

                            return;
                        }

                }

            }
        });







    }





}